Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed performance regression in endsWith() #331

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

firewave
Copy link
Collaborator

@firewave firewave commented Nov 14, 2023

This regression was introduced in 8abab5c.

std::equal() is supposed to be faster than std::string::compare() and a benchmark even supports this: https://quick-bench.com/q/JkxxUMqC8wLufOw7AUI-l1K-n7Q. But somehow in our code it leads to a big performance regression when using the Clang compiler.

before

Benchmark 1: ./simplecpp -q -D__GNUC__ -D__x86_64__ -DHAVE_CONFIG_H -I ../../xrdp/build ../../xrdp/common/file.c
  Time (mean ± σ):     166.8 ms ±  29.3 ms    [User: 142.4 ms, System: 22.6 ms]
  Range (min … max):   131.9 ms … 218.9 ms    12 runs

after

Benchmark 1: ./simplecpp -q -D__GNUC__ -D__x86_64__ -DHAVE_CONFIG_H -I ../../xrdp/build ../../xrdp/common/file.c
  Time (mean ± σ):      11.5 ms ±   0.6 ms    [User: 9.0 ms, System: 2.6 ms]
  Range (min … max):    10.9 ms …  14.6 ms    216 runs

With GCC this also exists but is much less severe.

@firewave
Copy link
Collaborator Author

firewave commented May 6, 2024

Strangely I can no longer reproduce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant